<?php

class GaleriaController extends BaseController {

	/*
	|--------------------------------------------------------------------------
	| Default Home Controller
	|--------------------------------------------------------------------------
	|
	| You may wish to use controllers instead of, or in addition to, Closure
	| based routes. That's great! Here is an example controller method to
	| get you started. To route to this controller, just add the route:
	|
	|	Route::get('/', 'HomeController@showWelcome');
	|
	*/

	public function index()
	{
		$torneosCelebrados=Torneo::where('fecha','<',new DateTime())->get()->filter(
		
		function ($torneo){
			return ($torneo->imagenes->count()||$torneo->videos->count());
		});
		$torneos= array(
				
				'torneosCelebrados' => $torneosCelebrados
		
		);
		
		return View::make('contents.galeria',$torneos)->with('title','Galeria :: Paintballed');
	}
	public function fotostorneo($id){
		$fotos=array(
			'fotos'=>Torneo::find($id)->imagenes
		);
		return View::make('contents.fotos',$fotos)->with('title','Fotos :: Paintballed');
	}
	
	public function videostorneo($id){
		$videos=array(
				'videos'=>Torneo::find($id)->videos
		);
		return View::make('contents.videos',$videos)->with('title','Videos :: Paintballed');
	}

}